using System.Windows.Controls;
using NavigateExample.ViewModels;

namespace NavigateExample.Services.Navigation
{
    /// <summary>
    /// 基于View的导航服务接口
    /// </summary>
    public interface INavigationService
    {
        /// <summary>
        /// 当前显示的页面
        /// </summary>
        UserControl? CurrentPage { get; }

        /// <summary>
        /// 当前页面变更事件
        /// </summary>
        event Action? CurrentPageChanged;

        /// <summary>
        /// 设置导航容器控件
        /// </summary>
        /// <param name="contentControl">导航容器</param>
        void SetNavigationControl(ContentControl contentControl);

        /// <summary>
        /// 简单导航到指定View
        /// </summary>
        /// <typeparam name="TView">目标View类型</typeparam>
        void Navigate<TView>() where TView : UserControl;

        /// <summary>
        /// 带参数导航到指定View
        /// </summary>
        /// <typeparam name="TView">目标View类型</typeparam>
        /// <param name="parameters">导航参数</param>
        void Navigate<TView>(NavigationParameters parameters) where TView : UserControl;

        /// <summary>
        /// 带参数和回调的导航到指定View
        /// </summary>
        /// <typeparam name="TView">目标View类型</typeparam>
        /// <param name="parameters">导航参数</param>
        /// <param name="callback">导航结果回调</param>
        void Navigate<TView>(NavigationParameters parameters, Action<INavigationResult> callback) where TView : UserControl;

        /// <summary>
        /// 仅带回调的导航到指定View
        /// </summary>
        /// <typeparam name="TView">目标View类型</typeparam>
        /// <param name="callback">导航结果回调</param>
        void Navigate<TView>(Action<INavigationResult> callback) where TView : UserControl;

        /// <summary>
        /// 直接导航到指定页面
        /// </summary>
        /// <param name="page">页面实例</param>
        void Navigate(UserControl page);
    }
}